#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> v;

int main()
{
    int tmp(0), n(0);
    cin >> n;
    for(int i = 0; i < 2*n; i++)
    {
        cin >> tmp;
        if(tmp % 2 == 0) 
        {
            tmp++;
        }
        v.push_back(tmp);
    }
    int count = 0;
    for(int i = 0; i < 2*n; i += 2)
    {
        if (v[i+1] == v[i]) continue;
        else
        {
            count++;
            auto index = find(v.begin()+i+2, v.end(), v[i]);
            int tmp = *index;
            *index = v[i+1];
            v[i+1] = tmp;
        }
    }
    cout << count;
    return 0;
}